<?php
require_once(dirname(__FILE__) . '/../include/common.inc.php');
require_once(dirname(__FILE__) . '/inc/manageui.inc.php');
?>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $cfg_webname?></title>
    <script src="templates/js/jquery.min.js"></script>
    <link href="templates/style/login.css" rel="stylesheet" type="text/css"/>
    <script src="templates/js/cloud.js" type="text/javascript"></script>
    <script type="text/javascript" src="layer/layer.js"></script>
    <script>


        function login_do() {
            console.log("4556");
            if ($("#username").val() == "") {
                alert("请输入用户名！");
                $("#username").focus();
                return false;
            }
            if ($("#password").val() == "") {
                alert("请输入密码！");
                $("#password").focus();
                return false;
            }
            var _username = $("#username").val();
            var _password = $("#password").val();
            $.ajax({
                type: 'POST',
                url: "login_check.php",
                data: {op: 'check', username: _username, password: _password},
                dataType: 'JSON',
                success: function (result) {
                    console.log(result);

                    if (result.code == 0) {
                        //登入成功的提示与跳转
                        layer.msg('登入成功', {
                            offset: '15px'
                            , icon: 1
                            , time: 1000
                        }, function () {
                            window.location.href = "default.php"
                        });
                    } else {
                        layer.msg(result.msg);
                    }

                }
            });

        }

        function CheckForm() {
            console.log("submit");
            if ($("#username").val() == "") {
                alert("请输入用户名！");
                $("#username").focus();
                return false;
            }
            if ($("#password").val() == "") {
                alert("请输入密码！");
                $("#password").focus();
                return false;
            }
        }

        $(function () {
            $(".loginForm input").keydown(function () {
                $(this).prev().hide();
            }).blur(function () {
                if ($(this).val() == "") {
                    $(this).prev().show();
                }
            });

            $("#username").focus();


        });
    </script>
</head>
<style type="text/css">
    .loginbox ul li { margin-bottom: 10px !important; }

    .hide { display: none; }
</style>

<body style=" background-image:url(templates/images/login.jpg); background-repeat:no-repeat; background-position:center top; overflow:hidden;background-size: cover">
<div id="mainBody">
    <div id="cloud1" class="cloud"></div>
    <div id="cloud2" class="cloud"></div>
</div>
<div class="logintop">
    <span>天诚科技   服务热线：<?php echo $cfg_hotline; ?></span>
</div>

<div class="loginbody">
    <span class="systemlogo"></span>
    <form name="login" method="post" action="" onSubmit="return CheckForm()">
        <div class="form">
            <div class="title">
                <div class="tabs active">账号登录</div>
                <div class="tabs ">请登陆</div>
            </div>
            <div class="content ">
                <div class="formRow"><input type="text" class="text user" value="" id="username" placeholder="请输入用户名"/>
                </div>
                <div class="formRow">
                    <input type="password" class="text pwd" placeholder="请输入密码" name="password" type="password" value="" id="password"/>
                </div>
                <input type="hidden" name="dopost" value="login"/>
                <div class="formRow"><input type="button" value="登 录" id="login_btn" class="btn" onclick="login_do()"/>
                </div>
            </div>

        </div>
    </form>
    <div class="info"></div>


</div>

<div class="loginbm">修总管</div>
</body>
</body>
</html>
